import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
// import './registerServiceWorker';
import "@/server/socket";
import "@/assets/main.css";
import localstorage from "./server/localstorage";
// import Chat from "vue-beautiful-chat";
import { Button, Field, Popup, CellGroup } from "vant";
import "./server/androidMessage";
import "vant/lib/index.css";
Vue.use(Button);
Vue.use(Field);
Vue.use(Popup);
Vue.config.productionTip = false;
import "./server/serverMessage";
import "./server/webrtc";
const users = localstorage.get("userconfig");

if (!users) {
  const name = "xender_" + (~~(Math.random() * 100000)).toString();
  const num: number = Math.floor(Math.random() * 10 + 1);
  localstorage.set("userconfig", {
    username: name,
    img: "./assets/img/" + num + ".jpg"
  });
}
(window as any).router = router;
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
